package com.sn.author.common.enums;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author xiaom
 * @Date 2020/10/15 14:34
 * @Version 1.0.0
 * @Description <>
 **/
@Getter
public enum CommentTypeEnum {

    TEXT_TYPE(10,"文本"),
    CARD_TYPE(20,"名片"),
    VIDEO_TYPE(30,"视频");

    CommentTypeEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    private Integer type;

    private String desc;

    public static Optional<CommentTypeEnum> match(Integer type) {
        return Arrays.stream(CommentTypeEnum.values())
                .filter(t -> t.getType().equals(type))
                .findFirst();
    }
}
